package com.example.dem12;

/**
 * @program: xian-cheng
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-11-01 21:07
 **/
public class Peiqi extends Thread{
    @Override
    public void run() {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        synchronized (LockSuo.lock1){
            System.out.println(Thread.currentThread().getName()+"吃猪食");
            synchronized (LockSuo.lock2){
                System.out.println(Thread.currentThread().getName()+"吃狗食");
                System.out.println(Thread.currentThread().getName()+"可以吃饭了");
            }
        }
    }

}
